# coding: utf-8

from sqlalchemy import Column, String, Integer, Numeric, Date, DateTime
from marshmallow import Schema, fields
from model.model_base import Base


class BureauWeeklyRep(Base):
    __tablename__ = 'BureauWeeklyRep'#县局指标周报
    bureauid = Column(String(2), primary_key=True, comment='供电局编号')
    bureauname = Column(String(50), nullable=True, comment='供电局名称')
    sctrans_suc_rate = Column(Numeric(5,2), nullable=True, comment='专公变采集成功率')
    sctrans_num = Column(Integer, nullable=True, comment='专公变采集成功率排名')
    lowvolta_suc_rate = Column(Numeric(5,2), nullable=True,comment='低压采集成功率')
    lowvolta_num = Column(Integer, nullable=True, comment='低压采集成功率排名')
    less98 = Column(Integer, nullable=True, comment='采集成功率低于98台区数量')
    less98_num = Column(Integer, nullable=True, comment='采集成功率低于98台区数量排名')
    phovolta_suc_rate = Column(Numeric(5,2), nullable=True,comment='光伏采集成功率')
    phovolta_num = Column(Integer, nullable=True, comment='光伏采集成功率排名')
    import_time = Column(DateTime, nullable=True, comment='导入时间')
    weeknum = Column(Integer, primary_key=True, comment='第几周')
    monthnum = Column(Date, primary_key=True, comment='所属月份')
    area_flag = Column(String(1), nullable=True, comment='区域标志（1廊坊2衡水3邢台）')

class BureauWeeklyRepSchema(Schema):
    bureauid = fields.String()
    bureauname = fields.String()
    sctrans_suc_rate = fields.Number()
    sctrans_num = fields.Integer()
    lowvolta_suc_rate = fields.Number()
    lowvolta_num = fields.Integer()
    less98 = fields.Integer()
    less98_num = fields.Integer()
    phovolta_suc_rate = fields.Number()
    phovolta_num = fields.Integer()
    import_time = fields.DateTime(format="%Y-%m-%d %H:%M:%S.%f")
    weeknum = fields.Integer()
    monthnum = fields.Date()
    area_flag = fields.String()

bureauWeeklyRepSchema = BureauWeeklyRepSchema()



